package com.nowar.frame.proxy;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

/**
 * 注册bean
 *
 * @Author: 谢无殇。
 * @Date : 2023-01-14 21:21
 */
public class HttpProxyImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {
    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        registerBeanDefinition(importingClassMetadata, registry);
    }


    //可以通过@Configuration配置
    private void registerBeanDefinition(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        HttpProxyScannerConfigurer configurer = new HttpProxyScannerConfigurer();
        //获取配置项路径
        // 扫描路径
        configurer.setBasePackage("com.nowar.agent");
        configurer.postProcessBeanDefinitionRegistry(registry);
    }
}
